package com.gxa.dao;

import com.gxa.pojo.Alarm;
import com.gxa.pojo.AlarmVO;
import com.gxa.pojo.Resource;
import com.gxa.pojo.ResourceVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface ResourceMapper {

    @Select("select * from resource limit ${begin},${limit}")
    List<Resource> showResource(ResourceVO resourceVO);

    int getCount();

    List<Resource> selectByCondition(ResourceVO resourceVO);

    @Delete(("DELETE FROM resource WHERE resourceName=#{resourceName}"))
    int deleteByResourceName(String resourceName);

    @Insert("INSERT INTO resource(resourceId,resourceName,resourceType,parentNode,resourceURL,resourceSorting,creatTime,updateTime)\n" +
            "VALUES(#{resourceId},#{resourceName},#{resourceType},#{parentNode},#{resourceURL},#{resourceSorting},#{creatTime},#{updateTime}) ")
    int addResource(Resource resource);

    @Select("SELECT * FROM resource where resourceName=#{resourceName}")
    Resource selectByResourceName(String resourceName);
}
